package com.biaobiaoqi.scoreanalysis.administrator.action;

import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.biaobiaoqi.scoreanalysis.hibernate.bean.ClazzType;
import com.biaobiaoqi.scoreanalysis.service.IClazzTypeService;
import com.opensymphony.xwork2.ActionSupport;

public class ListClazzType extends ActionSupport {
	private static final Log log = LogFactory.getLog(ListClazzType.class);
	private static final long serialVersionUID = 2046922866450056819L;
	@Resource
	private IClazzTypeService clazzTypeService;
	private int currentPage = 0;
	private List<ClazzType> list;

	public String execute() {
		log.debug("currentPage:" + currentPage);
		try {
			list = clazzTypeService.listClazzType(currentPage * 9, 9);
			return SUCCESS;
		} catch (Exception e) {
			log.error("list clazz type failed.", e);
			addActionError("读取班级类别列表失败");
			return ERROR;
		}
	}

	public IClazzTypeService getClazzTypeService() {
		return clazzTypeService;
	}

	public void setClazzTypeService(IClazzTypeService clazzTypeService) {
		this.clazzTypeService = clazzTypeService;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public List<ClazzType> getList() {
		return list;
	}

	public void setList(List<ClazzType> list) {
		this.list = list;
	}
}
